xquery version "0.9-ml"

(:	We do not need the id's of the names here because we are only returning a list
	of names to the wine form to make the data entry easier. Not using the id of any wines
:)

xs:string('<ul>')
,
let $wines := doc("wines.xml")/wines

for $var in distinct-values(
			($wines//wine/varietal) union
			($wines//wine/blend/blendPart/blendVarietal)
		)

order by $var
return concat('<li>', $var, '</li>')
,
xs:string('</ul>')